/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.hera.process.workflow.domain;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.TableGenerator;

import com.hera.base.domain.BaseDomain;

/**
 *
 * @author cmontes
 */
@Entity
@Table(name = "STAGE_ROLLUP")
public class StageRollup extends BaseDomain implements Serializable {
    private static final long serialVersionUID = 1L;
    
    @Id
    @GeneratedValue(strategy = GenerationType.TABLE, generator = "StageRollup")
    @TableGenerator(name = "StageRollup", table = "sequence", pkColumnName = "seq_name", valueColumnName = "seq_id", pkColumnValue = "STAGEROLLUP", allocationSize = 1)
    @Column(name = "ID_STAGE_ROLLUP")
    private Long idStageRollup;    
    /*@Column(name = "ID_STAGE")
    private Long idStageFrom;
    @Column(name = "ID_STAGE_NEXT")
    private Long idStageTo;*/
    @JoinColumn(name = "ID_STAGE_NEXT", referencedColumnName = "ID_STAGE"/*, insertable = false, updatable = false*/)
    @ManyToOne()
    private Stage stageTo;
    @JoinColumn(name = "ID_STAGE", referencedColumnName = "ID_STAGE"/*, insertable = false, updatable = false*/)
    @ManyToOne()
    private Stage stageFrom;
    
    @Column(name = "REFERENCE_DIAGRAM")
    private String referenceDiagram;    
    @Column(name = "ID_FIGURE_FROM")
    private String idFigureFrom;
    @Column(name = "ID_FIGURE_TO")
    private String idFigureTo;
    @Column(name = "ID_FIGURE")
    private String idFigure;

    @Column(name = "ID_PROCESS")
    private Long idProcess;

    public StageRollup() {
    }

    public StageRollup(Long idStageRollup) {
        this.idStageRollup = idStageRollup;
    }

           
    public Stage getStageTo() {
		return stageTo;
	}

	public void setStageTo(Stage stageTo) {
		this.stageTo = stageTo;
	}

	public Stage getStageFrom() {
		return stageFrom;
	}

	public void setStageFrom(Stage stageFrom) {
		this.stageFrom = stageFrom;
	}

	public Long getIdStageRollup() {
		return idStageRollup;
	}

	public void setIdStageRollup(Long idStageRollup) {
		this.idStageRollup = idStageRollup;
	}

	/*
	public Long getIdStageFrom() {
		return idStageFrom;
	}

	public void setIdStageFrom(Long idStageFrom) {
		this.idStageFrom = idStageFrom;
	}

	public Long getIdStageTo() {
		return idStageTo;
	}

	public void setIdStageTo(Long idStageTo) {
		this.idStageTo = idStageTo;
	}*/

	public String getReferenceDiagram() {
		return referenceDiagram;
	}

	public void setReferenceDiagram(String referenceDiagram) {
		this.referenceDiagram = referenceDiagram;
	}	

	public String getIdFigureFrom() {
		return idFigureFrom;
	}

	public void setIdFigureFrom(String idFigureFrom) {
		this.idFigureFrom = idFigureFrom;
	}

	public String getIdFigureTo() {
		return idFigureTo;
	}

	public void setIdFigureTo(String idFigureTo) {
		this.idFigureTo = idFigureTo;
	}

	public String getIdFigure() {
		return idFigure;
	}

	public void setIdFigure(String idFigure) {
		this.idFigure = idFigure;
	}

	public Long getIdProcess() {
		return idProcess;
	}

	public void setIdProcess(Long idProcess) {
		this.idProcess = idProcess;
	}

	@Override
    public int hashCode() {
        int hash = 0;
        hash += (idStageRollup != null ? idStageRollup.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        
        if (!(object instanceof StageRollup)) {
            return false;
        }
        StageRollup other = (StageRollup) object;
        if ((this.idStageRollup == null && other.idStageRollup != null) || (this.idStageRollup != null && !this.idStageRollup.equals(other.idStageRollup))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.hera.process.data.domain2.StageRollup[ idStageRollup=" + idStageRollup + " ]";
    }
    
}
